package baidu.reader.common.model
{
    import baidu.reader.common.*;
    import baidu.reader.common.model.VO.*;
    import flash.events.*;

	public class AppPreferenceModel extends flash.events.EventDispatcher
	{
		private var _displayType:String;
		
		private var _fontName:String="宋体";
		
		private var _fontSize:int=14;
		
		private var _leading:int=12;
		
		private var _currentPreference:baidu.reader.common.model.VO.AppPreferenceVO;
		
		public function AppPreferenceModel(arg1:flash.events.IEventDispatcher=null)
		{
			super(arg1);
			this._currentPreference = baidu.reader.common.model.LocalStorageModel.getCurrentPreference();
			if (this._currentPreference)
			{
				this._displayType = this._currentPreference.displayType;
				this._fontName = this._currentPreference.fontName;
				this._fontSize = this._currentPreference.fontSize;
				this._leading = this._currentPreference.leading;
			}
			return;
		}
		
		public function get displayType():String
		{
			return this._displayType;
		}
		
		public function set displayType(arg1:String):void
		{
			if (this._displayType == arg1 && !arg1)
			{
				return;
			}
			this._displayType = arg1;
			dispatchEvent(new baidu.reader.common.ReaderEvent(baidu.reader.common.ReaderEvent.DISPLAY_TYPE_CHANGED));
			this._currentPreference = baidu.reader.common.model.VO.AppPreferenceVO.getVOfromObject(this);
			baidu.reader.common.model.LocalStorageModel.setCurrentPreference(this._currentPreference);
			return;
		}
		
		public function get fontName():String
		{
			return this._fontName;
		}
		
		public function set fontName(arg1:String):void
		{
			if (this._fontName == arg1 && !arg1)
			{
				return;
			}
			this._fontName = arg1;
			this._currentPreference = baidu.reader.common.model.VO.AppPreferenceVO.getVOfromObject(this);
			baidu.reader.common.model.LocalStorageModel.setCurrentPreference(this._currentPreference);
			return;
		}
		
		public function get fontSize():int
		{
			return this._fontSize;
		}
		
		public function set fontSize(arg1:int):void
		{
			if (this._fontSize == arg1)
			{
				return;
			}
			this._fontSize = arg1;
			this._currentPreference = baidu.reader.common.model.VO.AppPreferenceVO.getVOfromObject(this);
			baidu.reader.common.model.LocalStorageModel.setCurrentPreference(this._currentPreference);
			return;
		}
		
		public function get leading():int
		{
			return this._leading;
		}
		
		public function set leading(arg1:int):void
		{
			if (this._leading == arg1)
			{
				return;
			}
			this._leading = arg1;
			this._currentPreference = baidu.reader.common.model.VO.AppPreferenceVO.getVOfromObject(this);
			baidu.reader.common.model.LocalStorageModel.setCurrentPreference(this._currentPreference);
			return;
		}
		
		
	}
}
